package cn.daniellee.plugin.pm.menu;

import cn.daniellee.plugin.pm.PartnerMission;
import cn.daniellee.plugin.pm.component.ItemGenerator;
import org.bukkit.inventory.ItemStack;

public class MenuCommon {

	public static ItemStack getCorner() {
		return ItemGenerator.getItem(" ", null, PartnerMission.getInstance().getConfig().getString("menu.common.corner.material", "MAGENTA_STAINED_GLASS_PANE"),  PartnerMission.getInstance().getConfig().getInt("menu.common.corner.durability", 0));
	}

	public static ItemStack getBorder() {
		return ItemGenerator.getItem(" ", null, PartnerMission.getInstance().getConfig().getString("menu.common.border.material", "BLUE_STAINED_GLASS_PANE"),  PartnerMission.getInstance().getConfig().getInt("menu.common.border.durability", 0));
	}

	public static String parseVariable(String text, String config, String variable) {
		String result = text.replace("§", "&");
		for (String item : config.replace(variable, "＠").split("＠")) result = result.replace(item, "");
		return result;
	}
}
